float resource_scale;
} StCornerSpec;
+typedef enum {
+ ST_PAINT_BORDERS_MODE_COLOR,
+ ST_PAINT_BORDERS_MODE_SILHOUETTE
+} StPaintBordersMode;
+
static void
elliptical_arc (cairo_t *cr,
double x_center,
if (corner.color.alpha == 0 &&
corner.border_color_1.alpha == 0 &&
corner.border_color_2.alpha == 0)
- return NULL;
+ {
+ if (node->box_shadow == NULL)
+ return NULL;
+ else /* We still need a corner texture to render the box-shadow */
+ corner.color = (ClutterColor) {0, 0, 0, 255};
+ }
key = corner_to_string (&corner);
texture = st_texture_cache_load (cache, key, ST_TEXTURE_CACHE_POLICY_FOREVER, load_corner, &corner, NULL);
static void st_theme_node_paint_borders (StThemeNodePaintState *state,
CoglFramebuffer *framebuffer,
const ClutterActorBox *box,
+ StPaintBordersMode mode,
guint8 paint_opacity);
void
state->box_shadow_pipeline = _st_create_shadow_pipeline (box_shadow_spec,
state->prerendered_texture,
state->resource_scale);
- else if (node->background_color.alpha > 0 || has_border)
+ else
st_theme_node_prerender_shadow (state);
}
st_theme_node_paint_borders (StThemeNodePaintState *state,
CoglFramebuffer *framebuffer,
const ClutterActorBox *box,
+ StPaintBordersMode mode,
guint8 paint_opacity)
{
StThemeNode *node = state->node;
int corner_id, side_id;
ClutterColor border_color;
guint8 alpha;
+ gboolean corners_are_transparent;
width = box->x2 - box->x1;
height = box->y2 - box->y1;
}
}
+ corners_are_transparent = mode == ST_PAINT_BORDERS_MODE_COLOR &&
+ node->background_color.alpha == 0 &&
+ node->border_color[0].alpha == 0;
+
/* corners */
- if (max_border_radius > 0 && paint_opacity > 0)
+ if (max_border_radius > 0 && paint_opacity > 0 && !corners_are_transparent)
{
for (corner_id = 0; corner_id < 4; corner_id++)
{
}
/* background color */
- alpha = paint_opacity * node->background_color.alpha / 255;
+ alpha = mode == ST_PAINT_BORDERS_MODE_SILHOUETTE ?
+ 255 :
+ paint_opacity * node->background_color.alpha / 255;
if (alpha > 0)
{
st_theme_node_ensure_color_pipeline (node);
state->resource_scale, 1);
cogl_framebuffer_clear4f (framebuffer, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 0);
- st_theme_node_paint_borders (state, framebuffer, &box, 0xFF);
+ st_theme_node_paint_borders (state, framebuffer, &box, ST_PAINT_BORDERS_MODE_SILHOUETTE, 0xFF);
state->box_shadow_pipeline = _st_create_shadow_pipeline (st_theme_node_get_box_shadow (node),
buffer, state->resource_scale);
}
else
{
- st_theme_node_paint_borders (state, framebuffer, box, paint_opacity);
+ st_theme_node_paint_borders (state, framebuffer, box, ST_PAINT_BORDERS_MODE_COLOR, paint_opacity);
}
st_theme_node_paint_outline (node, framebuffer, box, paint_opacity);